#pragma once

#include <chrono>
#include <cstdint>

struct PerformanceStats {
    std::atomic<uint64_t> market_data_processed{0};
    std::atomic<uint64_t> orders_processed{0};
    std::atomic<uint64_t> positions_updated{0};
    std::chrono::microseconds total_time{0};
    std::chrono::microseconds market_data_time{0};
    std::chrono::microseconds order_time{0};
    std::chrono::microseconds position_time{0};
    
    void reset() {
        market_data_processed = 0;
        orders_processed = 0;
        positions_updated = 0;
        total_time = std::chrono::microseconds{0};
        market_data_time = std::chrono::microseconds{0};
        order_time = std::chrono::microseconds{0};
        position_time = std::chrono::microseconds{0};
    }
};

class BacktestEngine {
public:
    // 性能统计
    BacktestStats stats_;
    
    void printStatistics() const;
    
    // 其他原有方法声明...
    void processMarketData(const MarketData& data);
    void processOrder(const Order& order);
    void updatePosition(const Position& position);
};